﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ServiceApplication.Service;
using CommonLibrary.DataModel.Form;
using System.Xml.Linq;
using CommonLibrary.Common;

namespace AspWebTest
{
    public partial class FormShow : System.Web.UI.Page
    {
        FormService formService = new FormService();
        SerializeDesigner designer = new SerializeDesigner();
        string formdefine;
        protected void Page_Load(object sender, EventArgs e)
        {
            int formid;
            if (int.TryParse(Request.QueryString["formid"].ToString(), out formid))
            {
                FormEntity formEntity = formService.QueryFormEntity(formid);
                if (formEntity != null)
                {
                    XElement xml = XElement.Load(Server.MapPath("~/uploads/" + formEntity.location));

                    //返回
                    formdefine = designer.DeserializeXmlToWeb(xml);
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("FormSetting.aspx");
        }

        public string getDefine()
        {
            return formdefine;
            //return " <input id='text1' runat='server' name='text1' type='text' style='left:40px; top:70px;width:40px;height:40px; position: absolute; '  />";

            //return " <h1 style='text-align:left; position: relative;top:20px;left:20px '>表单：'表单名'</h1> <div id='C1'  name='C1' style='left:74px; top:167px;width:41px;height:19px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [ControlText]</ForeColor>;background:<BackColor>Color [Control]</BackColor> '>部门：</div><select id='C2' name='C2'  style='left:125px; top:167px;width:80px;height:20px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [WindowText]</ForeColor>;background:<BackColor>Color [Window]</BackColor>'><option  value='1'>1</option><option  value='2'>2</option><option  value='3'>3</option></select><div  style='left:125px; top:135px;width:63px;height:26px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [ControlText]</ForeColor>;background:<BackColor>Color [Control]</BackColor> '><input id='C3' name='C3' type='checkbox' />海归？</div><input id='C4'  name='C4' type='radio'  style='left:167px; top:109px;width:38px;height:20px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [ControlText]</ForeColor>;background:<BackColor>Color [Control]</BackColor> '  value='女'/><input id='C5'  name='C5' type='radio'  style='left:125px; top:111px;width:36px;height:18px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [ControlText]</ForeColor>;background:<BackColor>Color [Control]</BackColor> '  value='男'/> <div id='C6'  name='C6' style='left:74px; top:114px;width:45px;height:19px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [ControlText]</ForeColor>;background:<BackColor>Color [Control]</BackColor> '>性别：</div><input id='C7'  name='C7' type='text' style='left:125px; top:76px;width:80px;height:21px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [WindowText]</ForeColor>;background:<BackColor>Color [Window]</BackColor> '  value=''/> <div id='C8'  name='C8' style='left:74px; top:79px;width:45px;height:19px; position: absolute;font: 宋体; font-size: 9px;font-style:normal; font-weight:normal;color:<ForeColor>Color [ControlText]</ForeColor>;background:<BackColor>Color [Control]</BackColor> '>姓名：</div> ";

     

        }
    }
}
